/*
RippleLogger.enabled = true;
l = RippleLogger.new;
l.fileName = "bbb"
l.log("test2")
*/


RippleLogger{
	classvar <>enabled = false, startTime;
	var <>fileName;
	
	*initClass{
		startTime = SystemClock.seconds;
	}
	
	*new{
		^super.new.init;
	}
	
	init{
		fileName = "log";	
	}
	
	log{|text|
		var f, seconds, pathName, fileMode;
		if(enabled == false){
			^nil;
		};
		pathName = "logs/" ++ fileName;
		seconds = thisThread.seconds - startTime;
		
		if(File.exists(pathName),
			{fileMode = "a"},
			{fileMode = "w"}
		);
		
		f = File(pathName,fileMode);
		f.write(seconds.asString ++ ": " + text  +  "\n\n");
		f.close;
	}
	
	
}